<%--
  Created by IntelliJ IDEA.
  User: LCH
  Date: 2021/5/8
  Time: 22:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Ajax注册成功页面!</title>
</head>
<body>
<%
  String studentName = request.getParameter("studentName");
  String age = request.getParameter("age");
  request.setAttribute("studentName",studentName);
  request.setAttribute("age",age);

  String languages[] = request.getParameterValues("languages");
  if(languages==null){
    request.setAttribute("languages0","暂无精通语言");
  }else{
    for (int i = 0; i < languages.length; i++) {
      request.setAttribute("languages" + i, languages[i]);
      System.out.println("languages" + i);
    }
  }

  if(request.getParameter("sex")!=null){

    if (Integer.parseInt(request.getParameter("sex"))==0){
      request.setAttribute("sex","男");
    }else if(Integer.parseInt(request.getParameter("sex"))==1){
      request.setAttribute("sex","女");
    }else {
      request.setAttribute("sex","保密");
    }
  }else{
    request.setAttribute("sex","未选择任何性别");
  }
  String birthday = request.getParameter("birthday");
  request.setAttribute("birthday",birthday);
%>

<h1>学生注册成功</h1>
<ol>
  <li>学生姓名:${requestScope.studentName}</li>
  <li>学生年龄:${requestScope.age}</li>
  <li>学生性别:<%=request.getAttribute("sex") %></li>
  <li>精通的语言:${requestScope.languages0}&nbsp;&nbsp;${requestScope.languages1}&nbsp;${requestScope.languages2}</li>
  <li>出生年月:<%=request.getAttribute("birthday") %></li>
</ol>

</body>
</html>
